package cn.good.yan.controller;

import cn.good.yan.resp.ResultData;
import cn.good.yan.service.CxxService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 演示：分布式事务  - bxx
 * 依次的启动： 2001 、 2002 、 2003
 * 发起者在 - BxxServiceImpl
 *
 * @author shengren.yan
 * @create 2022-04-06
 */
@RestController
public class CxxController {
    @Resource
    private CxxService cxxService;

    /**
     * 扣减库存 （根据产品id）
     */
    @RequestMapping("/cxx/decrease")
    public ResultData decrease(Long productId, Integer count) {
        cxxService.decrease(productId, count);
        return ResultData.success("扣减库存成功!");
    }

}

